/*    */ package com.zimbra.cs.account;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.common.util.ZimbraLog;
/*    */ import com.zimbra.soap.admin.type.CacheEntryType;
/*    */ import java.util.HashMap;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public abstract class CacheExtension
/*    */ {
/*    */   private static Map<String, CacheExtension> mHandlers;
/*    */   
/*    */   public static synchronized void register(String cacheType, CacheExtension handler)
/*    */   {
/* 37 */     if (mHandlers == null) {
/* 38 */       mHandlers = new HashMap();
/*    */     }
/*    */     else {
/* 41 */       CacheExtension obj = (CacheExtension)mHandlers.get(cacheType);
/* 42 */       if (obj != null) {
/* 43 */         ZimbraLog.account.warn("cache type " + cacheType + " is already registered, " + "registering of " + obj.getClass().getCanonicalName() + " is ignored");
/*    */         
/* 45 */         return;
/*    */       }
/*    */       
/*    */ 
/* 49 */       CacheEntryType cet = null;
/*    */       try {
/* 51 */         cet = CacheEntryType.fromString(cacheType);
/*    */       }
/*    */       catch (ServiceException e) {}
/*    */       
/* 55 */       if (cet != null) {
/* 56 */         ZimbraLog.account.warn("cache type " + cacheType + " is one of the internal cache type, " + "registering of " + obj.getClass().getCanonicalName() + " is ignored");
/*    */         
/* 58 */         return;
/*    */       }
/*    */     }
/* 61 */     mHandlers.put(cacheType, handler);
/*    */   }
/*    */   
/*    */   public static synchronized CacheExtension getHandler(String cacheType) {
/* 65 */     if (mHandlers == null) {
/* 66 */       return null;
/*    */     }
/* 68 */     return (CacheExtension)mHandlers.get(cacheType);
/*    */   }
/*    */   
/*    */   public abstract void flushCache()
/*    */     throws ServiceException;
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/account/CacheExtension.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */